import request from "./request";

// 注册
export function register(params) {
  return request("/users/register", {
    method: "POST",
    data:params
  });
}
// 登录
export function login(data) {
  return request("/users/login", {
    method: "POST",
    data
  });
}
// 修改资料
export function updateUser(params) {
  return request("/users/update", {
    method: "POST",
    data:params
  });
}
// 查个人信息
export function findInfo(params){
  return request("/users/findInfo", {
    method: "GET",
    params
  });
}
// 获取个人详情页信息
export function getUserDetail(params){
  return request("/users/getUserDetail", {
    method: "GET",
    params
  });
}
/** 文章区域 **/ 
// 发布文章
export function addPublic(params) {
  return request("/public/addPublic", {
    method: "POST",
    data:params
  });
}
// 获取个人文章
export function getContent(params) {
  return request("/public/findPublic", {
    method: "GET",
    params
  })
}
// 获取首页所有文章
export function getAllContent(params) {
  const {come='home'}=params
  return request(`/public/findAllPublic/${come}`, {
    method: "GET",
    params
  })
}
// 详情页
export function getDetail(params) {
  return request(`/public/detail`, {
    method: "GET",
    params
  })
}
// 详情评论列表
 export  function findReviewList(params){
  return request("/public/findReview",{
    method:"GET",
    params
  })
 }
// 新增评论
export function addReview(data){
  return request("/public/addReview",{
    method:'POST',
    data
  })
}
// 删除评论
export function delReview(data){
  return request("/public/delReview",{
    method:'POST',
    data
  })
}
// 点赞
export function sendHeart(data){
  return request("/public/updateHeart",{
    method:'POST',
    data
  })
}
// 查询是否已点赞
export function findFavorite(params){
  return request("/public/findFavorite",{
    method:'GET',
    params
  })
}
// 收藏
export function sendCollection(data){
  return request("/public/updateCollection",{
    method:'POST',
    data
  })
}
// 查询是否已收藏
export function findCollection(params){
  return request("/public/findCollection",{
    method:'GET',
    params
  })
}
// 查询喜欢列表
export function getLiked(params){
  return request("/public/getLiked",{
    method:'GET',
    params
  })
}
// 查询收藏列表
export function getCollection(params){
  return request("/public/getCollection",{
    method:'GET',
    params
  })
}
//搜索列表
export function getSearch(params){
  return request("/public/getSearchPublic",{
    method:'GET',
    params
  })
}
// 搜索用户列表
export function getSearchUserList(params){
  return request("/users/getSearchUser",{
    method:"GET",
    params
  })
}
// 关注与取消关注
export function updateFans(params){
  return request("/users/editFans",{
    method:'POST',
    data:params
  })
}
// 获取粉丝列表
export function getFans(params){
  return request("/users/getFansList",{
    method:"GET",
    params
  })
}
// 获取关注列表
export function getConcer(params){
  return request("/users/getConcerList",{
    method:"GET",
    params
  })
}
// 查询消息的评论列表
export function getReviewMessage(params){
  return request("/message/findReviewMessage",{
    method:"GET",
    params
  })
}



// 查询赞和收藏消息列表
export function getLikeAndFavoriteApi(params){
  return request("/message/getlikeAndFavorite",{
    method:"GET",
    params
  })
}
// 修改公开与私密
export function updateArea(data){
  return request("/public/updateArea",{
    method:"POST",
    data
  })
}
// 删除作品
export function deletePublic(data){
  return request("/public/delPublic",{
    method:"POST",
    data
  })
}
// 获取通知消息数量
export function getMessageNumberApi(params){
  return request("/message/messageNumber",{
    method:"GET",
    params
  })
}
// 修改通知消息数量
export function updateMessageNumberApi(data){
  return request("/message/updateMessageNumber",{
    method:"POST",
    data
  })
}

//添加进搜索列表
export function addSearchApi(data){
  return request("/search/addSearch",{
    method:"POST",
    data
  })
}

//查询搜索历史
export function searchHistoryApi(params){
  return request("/search/getSearchList",{
    method:"GET",
    params
  })
}
//获取他人文章
export function getOtherPublicApi(params){
  return request("/public/otherPublic",{
    method: "GET",
    params
  })
}
//删除搜索记录
export function delSearchApi(data){
  return request("/search/delSearch",{
    method:"POST",
    data
  })
}

//设置置顶评论
export function setTopReviewApi(data){
  return request("/public/setTopReview",{
    method:"POST",
    data
  })
}
//获取顶评论
export function getTopReviewApi(params){
  return request("/public/getTopReview",{
    method:"GET",
    params
  })
}
//删除置顶

export function delTopReviewApi(data){
  return request("/public/delTopReview",{
    method:"POST",
    data
  })
}
//获取隐私信息
export function getPrivacyApi(params){
  return request("/privacy/getPrivacy",{
    method:"GET",
    params
  })
}
//修改隐私信息
export function updatePrivacyApi(data){
  return request("/privacy/updatePrivacy",{
    method:"POST",
    data
  })
}
            /*后台*/
//获取后台文章
export function getManagePublicApi(params){
  return request("/public/manage/findManagePublic",{
    method:"GET",
    params
  })
}
export function updateManagePublicApi(data){
  return request("/public/manage/updateManagePublic",{
    method:"POST",
    data
  })
}
//获取后台用户
export function getManageUserApi(params){
  return request("/users/manage/ManageFindUser",{
    method:"GET",
    params
  })
}
//冻结用户
export function lockUserApi(data){
  return request("/users/manage/ManageLockUser",{
    method:"POST",
    data
  })
}
//删除用户
export function deleteUserApi(data){
  return request("/users/manage/ManageDeleteUser",{
    method:"POST",
    data
  })
}
//添加管理员
export function addAdminApi(data){
  return request("/users/manage/addAdmin",{
    method:"POST",
    data
  })
}
//查询管理员
export function getAdminApi(){
  return request("/users/manage/getAdmin",{
    method:"GET"
  })
}
//后台登录
export function loginAdminApi(data){
  return request("/users/manage/loginAdmin",{
    method: "POST",
    data
  })
}
//删除未审核文章
export function delCheckpublicApi(data){
  return request("/public/manage/delManagePublic",{
    method: "POST",
    data
  })
}